package com;

import com.pojo.Student;
import com.utils.MyBatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.List;

public class StudentTest {
    @Test
    public void findStudentByNameTest(){
        SqlSession session = MyBatisUtils.getSession();
        Student student = new Student();
        student.setSname("tom");
        student.setMajor("计应7班");
        List<Student> list = session.selectList("com.mapper.StudentMapper.findStudentByNameTest",student);
        for (Student stu :list){
            System.out.println(stu.getMajor());
        }
        session.close();

    }
    @Test
    public void findStudentByIdsTest(){
        SqlSession session = MyBatisUtils.getSession();
        Integer[] ids = {1,2,3};
        List<Student> student = session.selectList("com.mapper.StudentMapper.findStudentByIds",ids);
        for (Student stu :student){
            System.out.println(stu);
        }
        session.close();
    }
}
